package b.i.c.b;

import android.content.res.ColorStateList;
import android.graphics.Shader;

/* compiled from: ComplexColorCompat */
public final class a {
    public final Shader a;
    public final ColorStateList b;
    public int c;

    public a(Shader shader, ColorStateList colorStateList, int i) {
        this.a = shader;
        this.b = colorStateList;
        this.c = i;
    }

    /* JADX WARNING: Removed duplicated region for block: B:120:0x027d  */
    /* JADX WARNING: Removed duplicated region for block: B:6:0x0019  */
    /* JADX WARNING: Missing block: B:81:0x01c4, code skipped:
            throw new org.xmlpull.v1.XmlPullParserException(r1.toString());
     */
    public static b.i.c.b.a a(android.content.res.Resources r29, int r30, android.content.res.Resources.Theme r31) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException {
        /*
        r0 = r29;
        r1 = r31;
        r2 = r29.getXml(r30);
        r3 = android.util.Xml.asAttributeSet(r2);
    L_0x000c:
        r4 = r2.next();
        r5 = 2;
        r6 = 1;
        if (r4 == r5) goto L_0x0017;
    L_0x0014:
        if (r4 == r6) goto L_0x0017;
    L_0x0016:
        goto L_0x000c;
    L_0x0017:
        if (r4 != r5) goto L_0x027d;
    L_0x0019:
        r4 = r2.getName();
        r4.hashCode();
        r7 = "gradient";
        r8 = r4.equals(r7);
        r9 = 0;
        if (r8 != 0) goto L_0x005d;
    L_0x0029:
        r5 = "selector";
        r5 = r4.equals(r5);
        if (r5 == 0) goto L_0x003f;
    L_0x0031:
        r0 = b.i.b.f.f0(r0, r2, r3, r1);
        r1 = new b.i.c.b.a;
        r2 = r0.getDefaultColor();
        r1.m463init(r9, r0, r2);
        return r1;
    L_0x003f:
        r0 = new org.xmlpull.v1.XmlPullParserException;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = r2.getPositionDescription();
        r1.append(r2);
        r2 = ": unsupported complex color tag ";
        r1.append(r2);
        r1.append(r4);
        r1 = r1.toString();
        r0.<init>(r1);
        throw r0;
    L_0x005d:
        r4 = r2.getName();
        r7 = r4.equals(r7);
        if (r7 == 0) goto L_0x025f;
    L_0x0067:
        r4 = b.i.a.d;
        r4 = b.i.c.b.h.e(r0, r1, r3, r4);
        r7 = 8;
        r8 = "startX";
        r8 = b.i.c.b.h.c(r2, r8);
        r10 = 0;
        if (r8 != 0) goto L_0x007a;
    L_0x0078:
        r12 = 0;
        goto L_0x007f;
    L_0x007a:
        r7 = r4.getFloat(r7, r10);
        r12 = r7;
    L_0x007f:
        r7 = 9;
        r8 = "startY";
        r8 = b.i.c.b.h.c(r2, r8);
        if (r8 != 0) goto L_0x008b;
    L_0x0089:
        r13 = 0;
        goto L_0x0090;
    L_0x008b:
        r7 = r4.getFloat(r7, r10);
        r13 = r7;
    L_0x0090:
        r7 = 10;
        r8 = "endX";
        r8 = b.i.c.b.h.c(r2, r8);
        if (r8 != 0) goto L_0x009c;
    L_0x009a:
        r14 = 0;
        goto L_0x00a1;
    L_0x009c:
        r7 = r4.getFloat(r7, r10);
        r14 = r7;
    L_0x00a1:
        r7 = 11;
        r8 = "endY";
        r8 = b.i.c.b.h.c(r2, r8);
        if (r8 != 0) goto L_0x00ad;
    L_0x00ab:
        r15 = 0;
        goto L_0x00b2;
    L_0x00ad:
        r7 = r4.getFloat(r7, r10);
        r15 = r7;
    L_0x00b2:
        r7 = "centerX";
        r7 = b.i.c.b.h.c(r2, r7);
        r8 = 3;
        if (r7 != 0) goto L_0x00bd;
    L_0x00bb:
        r7 = 0;
        goto L_0x00c1;
    L_0x00bd:
        r7 = r4.getFloat(r8, r10);
    L_0x00c1:
        r11 = 4;
        r9 = "centerY";
        r9 = b.i.c.b.h.c(r2, r9);
        if (r9 != 0) goto L_0x00cc;
    L_0x00ca:
        r9 = 0;
        goto L_0x00d0;
    L_0x00cc:
        r9 = r4.getFloat(r11, r10);
    L_0x00d0:
        r11 = "type";
        r11 = b.i.c.b.h.c(r2, r11);
        r8 = 0;
        if (r11 != 0) goto L_0x00db;
    L_0x00d9:
        r11 = 0;
        goto L_0x00df;
    L_0x00db:
        r11 = r4.getInt(r5, r8);
    L_0x00df:
        r5 = "startColor";
        r5 = b.i.c.b.h.c(r2, r5);
        if (r5 != 0) goto L_0x00e9;
    L_0x00e7:
        r5 = 0;
        goto L_0x00ed;
    L_0x00e9:
        r5 = r4.getColor(r8, r8);
    L_0x00ed:
        r10 = "centerColor";
        r19 = b.i.c.b.h.c(r2, r10);
        r6 = 7;
        r10 = b.i.c.b.h.c(r2, r10);
        if (r10 != 0) goto L_0x00fc;
    L_0x00fa:
        r6 = 0;
        goto L_0x0100;
    L_0x00fc:
        r6 = r4.getColor(r6, r8);
    L_0x0100:
        r10 = "endColor";
        r10 = b.i.c.b.h.c(r2, r10);
        if (r10 != 0) goto L_0x010a;
    L_0x0108:
        r10 = 0;
        goto L_0x0111;
    L_0x010a:
        r10 = 1;
        r21 = r4.getColor(r10, r8);
        r10 = r21;
    L_0x0111:
        r8 = "tileMode";
        r8 = b.i.c.b.h.c(r2, r8);
        if (r8 != 0) goto L_0x011d;
    L_0x0119:
        r21 = r7;
        r7 = 0;
        goto L_0x0126;
    L_0x011d:
        r21 = r7;
        r7 = 0;
        r8 = 6;
        r8 = r4.getInt(r8, r7);
        r7 = r8;
    L_0x0126:
        r8 = "gradientRadius";
        r8 = b.i.c.b.h.c(r2, r8);
        if (r8 != 0) goto L_0x0132;
    L_0x012e:
        r22 = r9;
        r8 = 0;
        goto L_0x013a;
    L_0x0132:
        r8 = 5;
        r22 = r9;
        r9 = 0;
        r8 = r4.getFloat(r8, r9);
    L_0x013a:
        r4.recycle();
        r4 = r2.getDepth();
        r9 = 1;
        r4 = r4 + r9;
        r9 = new java.util.ArrayList;
        r23 = r8;
        r8 = 20;
        r9.<init>(r8);
        r24 = r15;
        r15 = new java.util.ArrayList;
        r15.<init>(r8);
    L_0x0153:
        r8 = r2.next();
        r25 = r14;
        r14 = 1;
        if (r8 == r14) goto L_0x01ca;
    L_0x015c:
        r14 = r2.getDepth();
        r26 = r13;
        if (r14 >= r4) goto L_0x0167;
    L_0x0164:
        r13 = 3;
        if (r8 == r13) goto L_0x01cc;
    L_0x0167:
        r13 = 2;
        if (r8 == r13) goto L_0x016b;
    L_0x016a:
        goto L_0x01c5;
    L_0x016b:
        if (r14 > r4) goto L_0x01c5;
    L_0x016d:
        r8 = r2.getName();
        r13 = "item";
        r8 = r8.equals(r13);
        if (r8 != 0) goto L_0x017a;
    L_0x0179:
        goto L_0x01c5;
    L_0x017a:
        r8 = b.i.a.e;
        r8 = b.i.c.b.h.e(r0, r1, r3, r8);
        r13 = 0;
        r14 = r8.hasValue(r13);
        r13 = 1;
        r20 = r8.hasValue(r13);
        if (r14 == 0) goto L_0x01aa;
    L_0x018c:
        if (r20 == 0) goto L_0x01aa;
    L_0x018e:
        r14 = 0;
        r27 = r8.getColor(r14, r14);
        r14 = 0;
        r28 = r8.getFloat(r13, r14);
        r8.recycle();
        r8 = java.lang.Integer.valueOf(r27);
        r15.add(r8);
        r8 = java.lang.Float.valueOf(r28);
        r9.add(r8);
        goto L_0x01c5;
    L_0x01aa:
        r0 = new org.xmlpull.v1.XmlPullParserException;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = r2.getPositionDescription();
        r1.append(r2);
        r2 = ": <item> tag requires a 'color' attribute and a 'offset' attribute!";
        r1.append(r2);
        r1 = r1.toString();
        r0.<init>(r1);
        throw r0;
    L_0x01c5:
        r14 = r25;
        r13 = r26;
        goto L_0x0153;
    L_0x01ca:
        r26 = r13;
    L_0x01cc:
        r0 = r15.size();
        if (r0 <= 0) goto L_0x01d8;
    L_0x01d2:
        r0 = new b.i.c.b.f;
        r0.m467init(r15, r9);
        goto L_0x01d9;
    L_0x01d8:
        r0 = 0;
    L_0x01d9:
        if (r0 == 0) goto L_0x01dd;
    L_0x01db:
        r1 = 1;
        goto L_0x01eb;
    L_0x01dd:
        if (r19 == 0) goto L_0x01e5;
    L_0x01df:
        r0 = new b.i.c.b.f;
        r0.m466init(r5, r6, r10);
        goto L_0x01db;
    L_0x01e5:
        r0 = new b.i.c.b.f;
        r0.m465init(r5, r10);
        goto L_0x01db;
    L_0x01eb:
        if (r11 == r1) goto L_0x0221;
    L_0x01ed:
        r2 = 2;
        if (r11 == r2) goto L_0x0213;
    L_0x01f0:
        r3 = new android.graphics.LinearGradient;
        r4 = r0.a;
        r0 = r0.b;
        if (r7 == r1) goto L_0x0200;
    L_0x01f8:
        if (r7 == r2) goto L_0x01fd;
    L_0x01fa:
        r1 = android.graphics.Shader.TileMode.CLAMP;
        goto L_0x0202;
    L_0x01fd:
        r1 = android.graphics.Shader.TileMode.MIRROR;
        goto L_0x0202;
    L_0x0200:
        r1 = android.graphics.Shader.TileMode.REPEAT;
    L_0x0202:
        r18 = r1;
        r11 = r3;
        r13 = r26;
        r14 = r25;
        r15 = r24;
        r16 = r4;
        r17 = r0;
        r11.<init>(r12, r13, r14, r15, r16, r17, r18);
        goto L_0x024f;
    L_0x0213:
        r3 = new android.graphics.SweepGradient;
        r1 = r0.a;
        r0 = r0.b;
        r10 = r21;
        r9 = r22;
        r3.<init>(r10, r9, r1, r0);
        goto L_0x024f;
    L_0x0221:
        r10 = r21;
        r9 = r22;
        r1 = 0;
        r1 = (r23 > r1 ? 1 : (r23 == r1 ? 0 : -1));
        if (r1 <= 0) goto L_0x0257;
    L_0x022a:
        r3 = new android.graphics.RadialGradient;
        r1 = r0.a;
        r0 = r0.b;
        r2 = 1;
        if (r7 == r2) goto L_0x023c;
    L_0x0233:
        r2 = 2;
        if (r7 == r2) goto L_0x0239;
    L_0x0236:
        r2 = android.graphics.Shader.TileMode.CLAMP;
        goto L_0x023e;
    L_0x0239:
        r2 = android.graphics.Shader.TileMode.MIRROR;
        goto L_0x023e;
    L_0x023c:
        r2 = android.graphics.Shader.TileMode.REPEAT;
    L_0x023e:
        r22 = r2;
        r16 = r3;
        r17 = r10;
        r18 = r9;
        r19 = r23;
        r20 = r1;
        r21 = r0;
        r16.<init>(r17, r18, r19, r20, r21, r22);
    L_0x024f:
        r0 = new b.i.c.b.a;
        r1 = 0;
        r2 = 0;
        r0.m463init(r3, r1, r2);
        return r0;
    L_0x0257:
        r0 = new org.xmlpull.v1.XmlPullParserException;
        r1 = "<gradient> tag requires 'gradientRadius' attribute with radial type";
        r0.<init>(r1);
        throw r0;
    L_0x025f:
        r0 = new org.xmlpull.v1.XmlPullParserException;
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = r2.getPositionDescription();
        r1.append(r2);
        r2 = ": invalid gradient color tag ";
        r1.append(r2);
        r1.append(r4);
        r1 = r1.toString();
        r0.<init>(r1);
        throw r0;
    L_0x027d:
        r0 = new org.xmlpull.v1.XmlPullParserException;
        r1 = "No start tag found";
        r0.<init>(r1);
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.i.c.b.a.a(android.content.res.Resources, int, android.content.res.Resources$Theme):b.i.c.b.a");
    }

    public boolean b() {
        return this.a != null;
    }

    public boolean c() {
        if (this.a == null) {
            ColorStateList colorStateList = this.b;
            if (colorStateList != null && colorStateList.isStateful()) {
                return true;
            }
        }
        return false;
    }

    public boolean d(int[] iArr) {
        if (c()) {
            ColorStateList colorStateList = this.b;
            int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
            if (colorForState != this.c) {
                this.c = colorForState;
                return true;
            }
        }
        return false;
    }
}
